package com.totoro.service;


import org.hibernate.Criteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.totoro.dao.BaseHibernateDao;
import com.totoro.dao.SchoolDao;
import com.totoro.domain.School;
import com.totoro.util.Page;

@Transactional
@Service
public class SchoolService extends BaseService<School, Integer>{
	
	
	private SchoolDao schoolDao;
	
	public SchoolService(){
		
	}
	
	@Autowired
	@Override
	public void setBaseDao(BaseHibernateDao<School, Integer> schoolDao) {
		this.baseDao = schoolDao;
		this.schoolDao = (SchoolDao) schoolDao;
	}
	
	//分页查询通过页号
	public Page<School> getPagePosts(Integer pageNo,int pageSize){
		Criteria criteria = schoolDao.createCriteria();
		return schoolDao.pagedQuery(criteria, pageNo, pageSize);
	}
	
	
}
